<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="/css/amazeui.min.css">
    <link rel="stylesheet" href="/css/amazeui.cropper.css">
    <link rel="stylesheet" href="/css/custom_up_img.css">


    <link rel="stylesheet" href="/css/reset.css">
    <link rel="stylesheet" href="/css/commone.css">
    <link rel="stylesheet" media="screen and (min-width:481px)" href="/css/usercenter.css">
    <link rel="stylesheet" media="screen and (max-width:480px)" href="/css/usercenter(1).css">

    <script src="/js/hm.js"></script>
    <script type="text/javascript">
        var basePath = "/";
    </script>
    <script src="/js/common.js"></script>
    <script src="/js/jquery-3.5.1.min.js"></script>
    <script src="/js/footfixed.js"></script>

    <script src="http://www.hasbei.com/static/layer/layer.js" type="text/javascript"></script>
    <link rel="stylesheet" href="http://www.hasbei.com/static/layer/theme/default/layer.css?v=3.1.1" id="layuicss-layer">
    <title>个人中心</title>


    <script src="/js/amazeui.min.js"></script>
    <script src="/js/cropper.min.js"></script>
    <script src="/js/custom_up_img.js"></script>

</head>
<body th:fragment="user_right">
<div th:replace="common/hasbei_top_user"></div>
<div class="content-main">
    <div class="main-info">
        <div th:replace="user/user_left"></div>

        <div class="main-user-right">
            <div class="user-right-top">
                <ul>
                    <li class="select-active" id="dy"><a href="javascript:;">站内消息</a></li>
                </ul>
            </div>
            <div class="user-right-action">
                <div id="myContent"><div class="action-item" id="item337">

                    <div class="action-item-title">
                        <a href="javascript:;" target="_self" onclick="read(this)" id="337">牙齿掉了，怎么处理？</a>
                    </div>
                    <div class="ansower-content">
                        <a href="javascript:;" target="_self" onclick="read(this)" id="337">审核通过</a>
                    </div>
                    <div class="ansower-share-setting">
                        <div class="ansower-share">



                            <a href="javascript:;" target="_self" onclick="read(this)" id="337">[提问审核]</a>





                            <a href="#" onclick="read(this)" id="337"><span>2020-07-21 16:51:59</span></a>



                            <a href="javascript:;" target="_self"><span>已读</span></a>


                        </div>
                    </div>


                </div><div class="action-item" id="item335">

                    <div class="action-item-title">
                        <a href="javascript:;" target="_self" onclick="read(this)" id="335">萧华林牙痛?</a>
                    </div>
                    <div class="ansower-content">
                        <a href="javascript:;" target="_self" onclick="read(this)" id="335">回复内容：建议去拔掉，懂？？？？？<br>审核描述：审核通过</a>
                    </div>
                    <div class="ansower-share-setting">
                        <div class="ansower-share">




                            <a href="javascript:;" target="_self" onclick="read(this)" id="335">[回答审核]</a>




                            <a href="#" onclick="read(this)" id="335"><span>2020-07-21 16:49:35</span></a>



                            <a href="javascript:;" target="_self"><span>已读</span></a>


                        </div>
                    </div>


                </div></div>
                <div class="more-content">
                    <div class="load-more" style="display: none;">
                        <img src="/img/load-more.gif">
                        <span>加载中</span>
                    </div>
                    <div class="load-more-two load-more-fade" style="" onclick="moreList()">点击加载更多</div>
                    <div class="no-data" style="display:none">┭┮﹏┭┮,没有数据啦</div>
                </div>
            </div>

        </div>


    </div>
</div>
<script>
    function editQaReply(obj){ //编辑回答
        var id=$(obj).attr("id");
        layer.open({
            type: 2,
            title: "编辑回答",
            shadeClose: false,
            area: ['900px', '600px'],
            fixed: true,
            maxmin: false,
            scrollbar: false,
            content:basePath+'user/center/qaReply/edit/'+id
        });
    }
    function read(obj){ //删除回答
        var id=$(obj).attr("id");
        $.post(basePath+"user/center/msg/read?ids="+id,function(data){
            if(data.success){
                layer.msg("已读");
                $("#r"+id).html("已读");
            }else{
                layer.msg(data.msg);
            }
        });
    }


    var current=1;
    var tabId="";
    //消息数据
    function msgList(){
        $(".load-more").show();
        $(".load-more-two").hide();
        $.post(basePath+"/user/msg?current="+current,function(data){
            $(".load-more").hide();
            //如果没有数据了就隐藏
            if(data.length==0){
                $(".load-more-two").hide();
                if(current==1){
                    $(".no-data").show();
                }
            }else{
                $(".load-more-two").show();
                $("#myContent").append(data);
            }
        });
    }
    function loadTabList(){
        if(tabId=='msg'){//动态
            msgList();
        }else if(tabId=='an'){// 回答

        }
    }
    //加载更多
    function moreList(){
        current++;
        loadTabList();
    }
    function initList(){
        tabId='msg';//动态
        msgList();
    }
    initList();//初始化

    //重新加载从第一页开始
    function initListPage1(){
        current=1;
        $("#myContent").html("");
        $(".load-more-two").hide();
        $(".no-data").hide();
        loadTabList();
    }

    //点击tab标签
    $(".user-right-top li").click(function(){
        var id=$(this).attr("id");
        if(id==tabId){
            return ;
        }
        tabId=id;
        initListPage1();
        $("li").removeClass("select-active");
        $(this).addClass("select-active");
    })

    $(".change-info-show").hide();
    $(".change-info-btn").click(function(){
        $(".change-info-top").hide();
        $(".change-info-show").show();
    })
    $(".write-box-input").change(function(){
        var inputle = $(this).val().length;
        $(".write-box-span i").text(inputle);
    })
    $(".write-box-textarea").change(function(){
        var textareale = $(this).val().length;
        $(".write-box-right i").text(textareale);
    })
    $(".write-box-input").focus(function(){
        $(this).parent().css("border-color","rgba(41,167,230,1)");
    })
    $(".write-box-input").blur(function(){
        $(this).parent().css("border-color","#ddd");
    })
    $(".write-box-textarea").focus(function(){
        $(this).parent().css("border-color","rgba(41,167,230,1)");
    })
    $(".write-box-textarea").blur(function(){
        $(this).parent().css("border-color","#ddd");
    })


    $(".sure-btn").click(function(){
        var inputval = $(".write-box-input").val();
        var textareaval =$(".write-box-textarea").val();
        if(inputval == "" || textareaval == ""){
            alert("请输入信息");
            return false;
        }
        $(".h3-name").text(inputval);
        $(".p-style").text(textareaval);

        $(".change-info-show").hide();
        $(".change-info-top").show();
    })
    $(".close-btn").click(function(){
        $(".change-info-show").hide();
        $(".change-info-top").show();
    })

</script>

</body>
</html>